package case1;
/*
    双色球
 */
import java.util.Arrays;
import java.util.Random;
import java.util.Scanner;

public class unionLotto {
    public static void main(String[] args) {
        int[] d = c();
        //b(d);
        int[] u = user();
        equal2(d,u);
    }
    public static int[] c() {
        int[] numbers = new int[7];
        Random r = new Random();
            for (int i = 0; i < numbers.length - 1; i++) {
                while (true) {
                int luck = r.nextInt(33) + 1;
                boolean flag = true;
                for (int y = 0; y < i; y++) {
                    if (luck == numbers[y]) {
                        flag = false;
                        break;
                    }
                }
                if(flag) {
                    numbers[i] = luck;
                    break;
                }
            }
        }
        int s = r.nextInt(16) + 1;
            numbers[6] =s;
            return numbers;
    }
    /*public static void b(int[] f) {
        System.out.print("[");
        for (int i : f) {
            System.out.print(i+"\t");
        }
        System.out.println("]");
    }*/
    public static int[] user() {
        int[] arr = new int[7];
        Scanner sc = new Scanner(System.in);
        for(int i=0;i<7;i++) {
            System.out.println("请输入第"+i+"个数字，不能重复！！");
            int a = sc.nextInt();
            arr[i] = a;
        }
        return arr;
    }
    public static void equal2(int[] a,int[] b) {
        int red =0;
        int blur =0;
        if(a.length== b.length) {
            for(int s =0;s< a.length-1;s++) {
                for(int j =0;j<a.length-1;j++) {
                    if(b[s]==a[s]) {
                        red++;
                    }
                }
            }
        } else {
            System.out.println("您输入的数字数量不足！！！");
        }
        if(a[6]==b[6]) {
            blur++;
        }
        System.out.println("命中红球"+red+" "+"命中蓝球"+blur);
    }
}
